package com.tunghuynh.hpbd;

import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.MediaController;
import android.widget.VideoView;

public class PlayVideo extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_play_video);

		VideoView videoView = (VideoView) findViewById(R.id.videoView1);

		// Creating MediaController
		MediaController mediaController = new MediaController(this);
		mediaController.setAnchorView(videoView);

		String path = "android.resource://com.tunghuynh.hpbd/" + R.raw.video;
		// specify the location of media file
		Uri uri = Uri.parse(path);

		// Setting MediaController and URI, then starting the videoView
		// videoView.setMediaController(mediaController);
		videoView.setVideoURI(uri);
		videoView.requestFocus();
		videoView.start();
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.play_video, menu);
		return true;
	}

}
